'''
扑克游戏，洗牌与发牌
'''
from enum import Enum


class PokerNum(Enum):
    J = (11, 'J')
    Q = (12, 'Q')
    K = (13, 'K')
    A = (14, 'A')
    Two = (15, '2')
    Three = (3, '3')
    Four = (4, '4')
    Five = (5, '5')
    Six = (6, '6')
    Seven = (7, '7')
    Eight = (8, '8')
    Nine = (9, '9')
    Ten = (10, '10')
    Joker_s = (16, 'joker')
    Joker_b = (17, 'JOKER')


# for item in PokerNum.__members__:
#     print(item)


class Poker:
    def __init__(self, color, num):
        self.color = color  # ♥、♣、♦、♠
        self.num = num  # 2-10，J、Q、K、A，大王、小王

    def __repr__(self):
        return '{}{}'.format(self.color, self.num.value[1])

    def __gt__(self, other):
        return self.num.value[0] > other.num.value[0]


class PokerGame:

    def __init__(self):
        nums = PokerNum.__members__.items()
        colors = ['♥', '♣', '♦', '♠']
        self.pokers = []
        for num in nums:
            # print('num:',num)
            if num[1] != PokerNum.Joker_b and num[1] != PokerNum.Joker_s:
                for color in colors:
                    # print('color',color)
                    p = Poker(color, num[1])
                    self.pokers.append(p)
        self.pokers.append(Poker('', PokerNum.Joker_b))
        self.pokers.append(Poker('', PokerNum.Joker_s))

    def __shuffle(self):
        print(set(self.pokers))

    def deal(self):
        self.__shuffle()
        poker_iter = iter(self.pokers)
        p1 = []
        p2 = []
        p3 = []
        for i in range(17):
            p1.append(next(poker_iter))
            p2.append(next(poker_iter))
            p3.append(next(poker_iter))
        # 排序
        p1.sort()
        p2.sort()
        p3.sort()
        return p1, p2, p3, list(poker_iter)


pg1 = PokerGame()
print(pg1.deal())
